If using the KMotion_dotNet.dll:
With an instance of the KM_Controller.cs class, call
the CompileAndLoadCoff(int thread, string fullpathto_c_file)
and then a WriteLine("Execute<thread>")
{
KM_Controller controller = new KM_Controller();
int thread = 1;
controller.CompileAndLoadCoff(thread, @"c:\my machine files\my homing
routine.c");
controller.WriteLine(String.Format("Execute{0}", thread));
}
Alternatively,
For single axis ops:
Set the Axis.AxisData.HomingScript to the file path(either the .c file or a
.py file if you want to run an IronPython script)
Once that is defined and saved, you can just call the Axis.DoHome()
method.
For homing all, set Machine.MachineData.HomingScript the same way as above
and call Machine.HomeAll()
As a third option, you can create a UserSetting with a DataType of
Command. This will generate a button in the UserSettings panel that you
can assign an IronPython script.
Let me know if you need any additional info, and either way you go I
suggest reading the program.cs in the KMotion_dotNet Console
project.
It goes over much of the core functionality in a single file.
-Brad Murry